const app = getApp()
Component({   
	properties: {        
		navbackground: {            
			type: String,            
			value: 'linear-gradient(120deg,#F58745 0%,#F56545 100%)'        
		},        
		backIconColor: {            
			type: String,            
			value: '#FFFFFF'        
		},        
		color: {            
			type: String,            
			value: '#FFFFFF'        
		},        
		navbarData: {            
			type: Object,  
			value: {},  
			observer: function(newVal, oldVal) {}      
		},        
		titleImg: {            
			type: String,            
			value: ''        
		},             
		homeIcon: {            
			type: String,            
			value: ''        
		},        
		fontSize: {            
			type: Number,            
			value: 16        
		},        
		iconHeight: {            
			type: Number,            
			value: 19       
		},        
		iconWidth: {            
			type:Number,            
			value: 58        
		}    
	},    
	attached: function(){        
		var that = this;        
		that.setNavSize();        
		that.setStyle();    
		// console.log(this.data.navbarData)
	},    
	data: {
		status: app.globalData.height,
		navHeight: app.globalData.barheight
	},    
	methods: {        
	// 通过获取系统信息计算导航栏高度        
	setNavSize: function() {      

	},        
	setStyle: function() {            
		var that  = this                
		// , containerStyle                
		, textStyle                
		, iconStyle;            
		// containerStyle = ['background:' + that.data.background].join(';');            
		textStyle = ['color:' + that.data.color, 'font-size:' + that.data.fontSize + 'px'].join(';');            
		iconStyle = ['width: ' + that.data.iconWidth + 'px','height: ' + that.data.iconHeight + 'px'].join(';');            
		that.setData({               
			// containerStyle: containerStyle,                
			textStyle: textStyle,                
			iconStyle: iconStyle            
		})        
	},        
	// 返回事件        
	back: function(){  
		let pages = getCurrentPages();
		if (pages.length === 1) {
			wx.switchTab({
				url: '/pages/index/index',
			})

		} else {
			wx.navigateBack()

		}       
	}, 
}})